<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('AdminCourse/index')}">课程管理</a></li>
        <li class="active"><a href="{:url('AdminCourse/add')}">添加课程</a></li>
    </ul>
    <form action="{:url('AdminCourse/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th width="150">课程名称<span class="form-required">*</span></th>
                        <td>
                            <input id="id" type="hidden" name="id" value="{$id}">
                            <input class="form-control" type="text" name="title"
                                    id="title" required value="{$title}" placeholder="请输入课程名称"/>
                        </td>
                    </tr>
                    <tr>
                        <th >科目<span class="form-required">*</span></th>
                        <td>
                            <select class="form-control" name="subject_id" id="subject_id">
                                <option value="">请选择科目</option>    
                                <foreach name="subjectList" item="vo">                                    
                                    <option value="{$vo.id}">{$vo.name}</option>
                                </foreach>                                
                            </select>
                        </td>
                    </tr>                    
                    <tr>
                        <th >班别<span class="form-required">*</span></th>
                        <td>
                            <select class="form-control" name="class_id" id="class_id">
                                    <option value="">请选择班别</option>
                                    <foreach name="classList" item="vo">                                    
                                        <option value="{$vo.id}">{$vo.name}</option>
                                    </foreach>                                    
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th >教师<span class="form-required">*</span></th>
                        <td>
                            <select class="form-control" name="teacher_id" id="teacher_id">
                                    <option value="">请选择教师</option>    
                                    <foreach name="teacherList" item="vo">                                    
                                        <option value="{$vo.id}">{$vo.name}</option>
                                    </foreach>                                
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>班额<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="num" id="num" value="{$num}"
                            required placeholder="请输入班额">                            
                        </td>
                    </tr>
                    <tr>
                        <th>课室<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="classroom" id="classroom" value="{$classroom}"
                            required placeholder="请输入课室名称">                            
                        </td>
                    </tr>
                    <tr>
                        <th>价格<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="price" id="price" value="{$price}"
                            required placeholder="请输入价格">                            
                        </td>
                    </tr>  
                    <tr>
                        <th>开班时间<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control js-bootstrap-date" type="text" name="open_time" id="open_time" value="{$open_time}"
                            required placeholder="请输入开班时间" autocomplete="off">                            
                        </td>
                    </tr>
                    <tr>
                        <th>上课时间<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="class_time" id="class_time" value="{$class_time}"
                            required placeholder="请输入上课时间">                            
                        </td>
                    </tr>
                    <tr>
                        <th>报名时间<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control js-bootstrap-datetime" type="text" name="signup_time" id="signup_time" value="{$signup_time}"
                            required placeholder="请输入报名时间" autocomplete="off">                            
                        </td>
                    </tr>
                    <tr>
                        <th>报名截止时间<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control js-bootstrap-date" type="text" name="cutoff_time" id="cutoff_time" value="{$cutoff_time}"
                            required placeholder="请输入截止时间" autocomplete="off">                            
                        </td>
                    </tr>
                    <tr>
                        <th>报名条件</th>
                        <td>
                            <textarea class="form-control" name="excerpt" style="height: 50px;"
                            placeholder="请填写报名要求">{$excerpt}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <th>课程介绍</th>
                        <td>
                            <script type="text/plain" id="content" name="content">{$content}</script>
                        </td>
                    </tr>                    
                </table>
                <hook name="portal_admin_article_edit_view_main"/>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                        <a class="btn btn-default" href="{:url('AdminCourse/index')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <table class="table table-bordered">
                    <tr>
                        <th><b>缩略图<span class="form-required">*</span></b></th>
                    </tr>
                    <tr>
                        <td>
                            <div style="text-align: center;">
                                <input type="hidden" name="thumbnail" id="thumbnail" value="{$thumbnail}">
                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                    <if condition="empty($thumbnail)">
                                            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                    id="thumbnail-preview"
                                                    width="135" style="cursor: pointer"/>
                                            <else/>
                                            <img src="{:cmf_get_image_preview_url($thumbnail)}"
                                                    id="thumbnail-preview"
                                                    width="135" style="cursor: pointer"/>
                                        </if>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                            </div>
                        </td>
                    </tr>                    
                   
                </table>

                <hook name="portal_admin_article_edit_view_right_sidebar"/>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });
        
        $('#subject_id').val("{$subject_id|default=''}");
        $('#level_id').val("{$level_id|default=''}");
        $('#class_id').val("{$class_id|default=''}");
        $('#teacher_id').val("{$teacher_id|default=''}");
    });

</script>
</body>
</html>
